from django.urls import path
from rest_framework.routers import DefaultRouter
from . import views

router = DefaultRouter()
# 在这里添加ViewSet路由

urlpatterns = [
#     # 园区管理
#     path('parks/', views.park_list, name='park_list'),
#     path('parks/<int:pk>/', views.park_detail, name='park_detail'),
#     path('parks/<int:pk>/buildings/', views.park_buildings, name='park_buildings'),
    
    # 楼宇管理
    path('buildings/', views.building_list, name='building_list'),
    path('buildings/<int:pk>/', views.building_detail, name='building_detail'),
    path('buildings/<int:pk>/floors/', views.building_floors, name='building_floors'),
    path('buildings/<int:pk>/devices/', views.building_devices, name='building_devices'),
    
    # 楼层管理
    path('floors/<int:pk>/', views.floor_detail, name='floor_detail'),
    path('floors/<int:pk>/rooms/', views.floor_rooms, name='floor_rooms'),
    path('floors/<int:pk>/public_devices/', views.floor_public_devices, name='floor_public_devices'),
    
    # 单元/房源管理
    path('units/<int:pk>/', views.unit_detail, name='unit_detail'),
    path('units/<int:pk>/devices/', views.unit_devices, name='unit_devices'),
    path('units/<int:pk>/contract/', views.unit_contract, name='unit_contract'),
    
    # 设备管理
    path('devices/', views.device_list, name='device_list'),
    path('devices/<int:pk>/', views.device_detail, name='device_detail'),
    path('available-devices/', views.available_devices, name='available_devices'),
    # path('devices/<int:pk>/status/', views.update_device_status, name='update_device_status'),
    
    # 车辆管理 - 管理员端API (队友的API)
    path('vehicles/', views.vehicle_list, name='vehicle_list'),
    path('vehicles/<int:pk>/', views.vehicle_detail, name='vehicle_detail'),
    
    # 车辆管理 - 用户端API (你的API)
    path('my-vehicles/', views.my_vehicles, name='my_vehicles'),  # 获取当前用户的车辆
    path('my-vehicles/add/', views.add_my_vehicle, name='add_my_vehicle'),  # 添加车辆
    path('my-vehicles/<int:pk>/', views.my_vehicle_detail, name='my_vehicle_detail'),  # 获取/更新/删除车辆
    path('check-plate-number/', views.check_plate_number, name='check_plate_number'),  # 验证车牌号是否可用
    path('vehicles/count/', views.vehicle_count, name='vehicle_count'),  # 当前用户车辆数量

    # Dashboard统计接口
    path('buildings/count/', views.building_count, name='building_count'),  # 建筑数量
    path('devices/count/', views.device_count, name='device_count'),  # 设备数量
    
    # 房源查询接口
    path('housing-query/', views.housing_query, name='housing_query'),  # 房源查询
]

urlpatterns += router.urls 